package org.brownflat.watergate.dao;

import org.brownflat.watergate.domain.Repository;
import org.hibernate.Criteria;

import static org.hibernate.criterion.Restrictions.eq;

/**
 * <p>&copy Rupert Jones 2012</p>
 *
 * @author rup
 */
@org.springframework.stereotype.Repository
public class RepositoryDAO extends AbstractHibernateDAO<Repository> {

    public RepositoryDAO() {
        super(Repository.class);
    }

    public Repository findByName(String name) {
        Criteria criteria = getCriteria().add(eq("name", name));
        return (Repository) criteria.uniqueResult();
    }
}
